document.cookie = "username = hsowan";
var cookies = document.cookie.split(";");
cookies.forEach(element => {
    element = element.trim();
    if(element.indexOf("username=hsowan") == 0){
        alert(element);
    }
});